# 元素访问 __getitem__ __setitem__

class MySeq:
    def __init__(self, start=0, step=1):
        self.start = start
        self.step = step
        self.changed = {}

    def __getitem__(self, item):
        try:
            return self.changed[item]
        except KeyError:
            return self.start + item * self.step

    def __setitem__(self, key, value):
        self.changed[key] = value


s = MySeq()
print(s[2])
s[2] = 100
print(s[2])

#
